package com.jerkin.isnull;

import java.util.Optional;

/**
 * @description:
 * @className:OptionalTest
 * @author:huhongzhi
 * @createTime:2021/3/16 19:02
 * @version:1.0
 */
public class OptionalTest {

    public static void main(String[] args) {

        User user = null;
        System.out.println(Optional.ofNullable(user).map(User::getName).orElse("test"));
    }
}